import os
import json


# 运行端口
PORT=5701
# 发送消息给go-cqhttp
HOST="127.0.0.1"
SENDPORT=5700
ROOTDIR = os.path.dirname(__file__)
# 数据库连接
CONNECTION = f'sqlite:///{ROOTDIR}/botData.db'
# f"mysql+pymysql://root:{quote('pwd')}@127.0.0.1:3306/qqbot?charset=utf8",
# 静态文件目录
STATIC_PATH = os.path.join(ROOTDIR, 'static')
# 文件上传下载
UPLOADDIR = os.path.join(ROOTDIR,"uploadfiles")
# forms 自定义表单
FORMDIR = os.path.join(ROOTDIR, "forms")
FORMPROTOTYPE = os.path.join(FORMDIR, 'form_prototype.html')
LAYUI_CSS_PATH = os.path.relpath(os.path.join(STATIC_PATH, 'css', 'layui.css'),FORMDIR)
LAYUI_JS_PATH = os.path.relpath(os.path.join(STATIC_PATH, 'layui.js'),FORMDIR)
AXIOS_PATH =  os.path.relpath(os.path.join(STATIC_PATH, "js", "axios.min.js"),FORMDIR)
TABLESELECT_JS = os.path.relpath(os.path.join(STATIC_PATH, "js", "lay-module", "tableSelect","tableSelect.js"),FORMDIR)
PROTOTYPE_JS = os.path.relpath(os.path.join(STATIC_PATH, "js", "prototype_form.js"),FORMDIR)

# form表单提交数据
# FOMR_TABLE_LENGTH = 50
FORM_UPLOAD_FILES_DIR = os.path.join(ROOTDIR, "formUploadFiles") # 表单提交文件目录

# 临时zip路径
ZIP_DIR = os.path.join(ROOTDIR, "zip_dir")
ZIP_FILE = os.path.join(ZIP_DIR, "temp.zip")
# 临时 Excel 路径
EXCEL_PATH = os.path.join(ROOTDIR, "excels", "temp.xlsx") 

# 主人
MASTER="1574779559"

# 外部访问地址
OUT_ADDRESS = "http://127.0.0.1:5701"

# Timer
INTERVAL = 15*60

def gen_setting():
    gs = globals()
    adict = {}
    for k in gs:
        if k.isupper():
            adict[k] = gs[k]
    return adict




if __name__=="__main__":
    
    print(json.dumps(gen_setting(), ensure_ascii=False, indent='\t'))
    